package com.cardetective.shopcar.network.api

import com.android.base_network.data.BaseResponse
import com.cardetective.shopcar.network.model.OrderDetailModel
import com.cardetective.shopcar.network.model.OrderListModel
import com.cardetective.shopcar.network.model.RefundReasonsModel
import kotlinx.coroutines.flow.Flow
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 * 订单
 * */
interface OrderApi {

    // 获取订单列表
    @GET("/v3/order/getOrder")
    fun getOrderList(
        @Query("tag") tag: String,
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): Flow<BaseResponse<OrderListModel>>

    // 订单详情
    @GET("/v3/order/getOrderDetail")
    fun getOrderDetail(
        @Query("orderSn") orderSn: String
    ): Flow<BaseResponse<OrderDetailModel>>

    // 退款原因
    @GET("/v3/pay/refundReasons")
    fun getRefundReasons(
    ): Flow<BaseResponse<List<RefundReasonsModel>>>

    // 申请退款
    @FormUrlEncoded
    @POST("/v3/pay/refundOrder")
    fun submitRefundReasons(
        @Field("orderSn") orderSn: String
    ): Flow<BaseResponse<String>>




}